<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
    class My_account_c extends CI_Controller {
        
        function __construct() {
            parent::__construct();
            $this->load->model(array('coordinator_m'));
        }
        
        function index($msg = '') {
            $data['content'] = 'pages/my_account';
            $data['title'] = 'My Account';
            $data['current_page'] = 'my-account-page';
            $data['class'] = '';
            $data['back_to'] = 'my_dashboard';
            $data['details'] = $this->coordinator_m->get_my_account($this->session->userdata('accid'));
            $data['msg'] = $msg;
            $this->load->view('includes/template', $data);
        }
        
        function update_my_account() {
            $data = array(
                'lname' => $this->input->post('lname'),
                'fname' => $this->input->post('fname'),
                'mname' => $this->input->post('mname'),
                'bday' => $this->input->post('bday'),
                'gender' => $this->input->post('gender'),
                'email' => $this->input->post('email'),
                'address' => $this->input->post('address'),
                'contact_no' => $this->input->post('contact_no')
            );
            $id = $this->session->userdata('accid');
            $this->coordinator_m->update_my_account($id, $data);
            $this->index('<p class="success">Account successfully updated.</p>');
        }
        
        function change_password() {
            $this->coordinator_m->change_password($this->session->userdata('accid'), $this->input->post('confirm_pass'));
            $this->index('<p class="success">Password successfully changed.</p>');
        }
        
        function check_old_pass() {
            echo $this->coordinator_m->check_old_password($this->session->userdata('accid'),$this->input->post('pass'));
        }
    }
    
/* End of file account_c.php */
/* Location: ./application/controllers/account_c.php */